<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>项目管理系统</title>
		<link href="static/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet">
		<link rel="stylesheet" type="text/css" href="static/css/wall.css" />
		<link rel="stylesheet" type="text/csss" href="static/date/css/datepicker.css" />
	</head>
	
	<body class="body">
		<div class="container" style="padding-top:60px">
		<%@ include file="top.jsp" %>
			<div class="row">
				<div class="span9">
					<form class="form-horizontal" action="task.jspx?m=save" method="post">
						<fieldset>
							<legend>添加新任务</legend>
							<c:if test="${param.code == 1001}">
								<div class="alert alert-error">
									<button class="close" data-dismiss="alert" type="button">×</button>
									请填完整任务信息
							    </div>
							</c:if> 
							<div class="control-group">
								<label class="control-label"  for="input01">任务名称</label>
								<div class="controls">
									<input id="input01" class="span5" name="name" type="text" x-webkit-speech="undefined">
									<p class="help-block">In addition to freeform text, any HTML5 text-based input appears like so.</p>
								</div>
							</div>
							<!-- <div class="control-group">
								<label class="control-label" for="input01">开始时间</label>
								<div class="controls">
									<input id="input01" name="begintime" class="span5" type="text" x-webkit-speech="undefined">
								</div>
							</div> -->
						<!-- 	<div  class="control-group">
								<label class="control-label" for="input01">开始时间</label>
								<div id="dp3" class="input-append date controls" data-date-format="dd-mm-yyyy" data-date="12-02-2012">
									<input class="span5" type="text" readonly="" value="12-02-2012" size="16"><span class="add-on">
										<i class="icon-th"></i>
									</span>
								</div>
							</div> -->
							<div  class="control-group">
								<label class="control-label" for="input01">开始时间</label>
								<div class="controls">
									<input id="dp1" class="span3" name="begintime" type="text" value="20-08-2012">
								</div>
							</div>
							<div  class="control-group">
								<label class="control-label" for="input01">截止时间</label>
								<div class="controls">
									<input id="dp2" class="span3" name="finishtime" type="text" value="20-08-2012">
								</div>
							</div>
							<!-- <div class="control-group">
								<label class="control-label" for="input01">截止时间</label>
								<div class="controls">
									<input id="input01" class="span5" name="finishtime" type="text" x-webkit-speech="undefined">
								</div>
							</div> -->
							<div class="control-group">
								<label class="control-label" for="input01">任务描述</label>
								<div class="controls">
									<textarea class="span5" name="describe" rows="8"></textarea>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="multiSelect">状态</label>
								<div class="controls">
									<select id="multiSelect" name="state">
										<option></option>
										<option value="新任务">新任务</option>
										<option value="进行中">进行中</option>
										<option value="已完成">已完成</option>
									</select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label" for="multiSelect">级别</label>
									<div class="controls">
										<select id="multiSelect" name="level">
											<option></option>
											<option value="重要紧急">重要紧急</option>
											<option value="重要不紧急">重要不紧急</option>
											<option value="紧急不重要">紧急不重要</option>
											<option value="不紧急不重要">不紧急不重要</option>
										</select>
									</div>
								</div>
							<div class="control-group">
								<label class="control-label" for="multiSelect">负责人</label>
									<div class="controls">
										<select id="multiSelect"  name="manager">
											<option></option>
											<c:forEach items="${requestScope.memberList}" var="member">
												<option value="${member.id }">${member.name}</option>
											</c:forEach>
										</select>
									</div>
								</div>
							<div class="form-actions">
								<button class="btn btn-primary" type="submit">保存</button>
								<a class="btn" href="task.jspx?id=${sessionScope.goal.id}&m=">返回</a>
							</div>
						</fieldset>
					</form>
				</div>
				<div class="span3"> </div>
			</div>
		</div>
		<script type="text/javascript" src="static/jquery/jquery.js"></script>
   		<script type="text/javascript" src="static/bootstrap/js/bootstrap.min.js"></script>
   		<script type="text/javascript" src="static/date/js/bootstrap-datepicker.js"></script>
			<script type="text/javascript">	
				$(function(){
				window.prettyPrint && prettyPrint();
				$('#dp1').datepicker({
				format: 'mm-dd-yyyy'
				});
				$('#dp2').datepicker();
				$('#dp3').datepicker();
				var startDate = new Date(2012,1,20);
				var endDate = new Date(2012,1,25);
				$('#dp4').datepicker()
				.on('changeDate', function(ev){
				if (ev.date.valueOf() > endDate.valueOf()){
				$('#alert').show().find('strong').text('The start date can not be greater then the end date');
				} else {
				$('#alert').hide();
				startDate = new Date(ev.date);
				$('#startDate').text($('#dp4').data('date'));
				}
				$('#dp4').datepicker('hide');
				});
				$('#dp5').datepicker()
				.on('changeDate', function(ev){
				if (ev.date.valueOf() < startDate.valueOf()){
				$('#alert').show().find('strong').text('The end date can not be less then the start date');
				} else {
				$('#alert').hide();
				endDate = new Date(ev.date);
				$('#endDate').text($('#dp5').data('date'));
				}
				$('#dp5').datepicker('hide');
				});
				});
		</script>
	
	
	</body>
</html>